package com.yang.designmode.singleton;

/**
 * 静态内部类单例模式
 */
public class StaticInnerSingleton {
    //私有化构造器
    private StaticInnerSingleton() {
    }

    //静态内部类
    private static class SingletonClassInstance {
        //声明一个外部类的静态成员变量，并且通过new  关键字创建对象和赋值
        private static final StaticInnerSingleton instance = new StaticInnerSingleton();
    }

    public static StaticInnerSingleton getInstance() {
        return SingletonClassInstance.instance;
    }
}